/* ===== Page Header ===== */
.page-header {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e0ead1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-direction: row-reverse;
  width: 80%;
  margin-left: 2%;
}

.page-header h1 {
  color: #2c4b2c;
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-direction: row-reverse;
  gap: 12px;
}

.page-header p {
  color: #596d52;
  font-size: 14px;
  direction: rtl;
}

/* ===== Statistics Section ===== */
.statistics-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
  width: 80%;
  margin-left: 2%;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 25px;
  box-shadow: rgba(0, 0, 0, 0.08) 0px 4px 12px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: all 0.3s ease;
  border-left: 4px solid #779e63;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: rgba(0, 0, 0, 0.15) 0px 8px 20px;
}

.stat-card.profit {
  border-left-color: #2c4b2c;
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

.stat-card.negative {
  border-left-color: #d32f2f;
  background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
}

.stat-card.negative .stat-icon {
  background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
}

.stat-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #779e63 0%, #596d52 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 28px;
  flex-shrink: 0;
}

.stat-card.profit .stat-icon {
  background: linear-gradient(135deg, #2c4b2c 0%, #1e3a1e 100%);
}

.stat-content {
  flex: 1;
  text-align: right;
}

.stat-label {
  color: #596d52;
  font-size: 13px;
  margin-bottom: 8px;
}

.stat-value {
  color: #2c4b2c;
  font-size: 24px;
  font-weight: 700;
}

/* ===== Orders Section ===== */
.orders-section {
  width: 80%;
  margin-left: 2%;
  margin-bottom: 50px;
}

.section-title {
  color: #2c4b2c;
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e0ead1;
  text-align: right;
}

.orders-list {
  display: flex;
  flex-direction: row-reverse;
  gap: 25px;
  justify-content: flex-start;
}

/* ===== Order Card ===== */
.order-card {
  background: white;
  border-radius: 12px;
  padding: 25px;
  box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;
  border-left: 4px solid #779e63;
  animation: slideIn 0.4s ease;
  transition: all 0.3s ease;
  direction: rtl;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.order-card.delivered {
  background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f4 100%);
  border-left-color: #4caf50;
  height: 1%;
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #e0ead1;
}

.btn-toggle-card {
  background: transparent;
  border: 2px solid #e0ead1;
  color: #2c4b2c;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.btn-toggle-card:hover {
  background: #e0ead1;
  border-color: #779e63;
}

.order-content {
  max-height: 2000px;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  opacity: 1;
}

.order-content.collapsed {
  max-height: 0;
  opacity: 0;
}

.order-id {
  color: #2c4b2c;
  font-size: 18px;
  font-weight: 600;
}

.order-customer {
  color: #596d52;
  font-size: 14px;
}

.order-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.detail-label {
  color: #596d52;
  font-size: 12px;
}

.detail-value {
  color: #2c4b2c;
  font-size: 14px;
  font-weight: 600;
}

/* ===== Driver Notes Section ===== */
.notes-section {
  margin: 20px 0;
  padding: 20px;
  background: #f9efe3;
  border-radius: 8px;
}

.notes-title {
  color: #2c4b2c;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.add-note-form {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.note-input {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid #e0ead1;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s ease;
}

.note-input:focus {
  outline: none;
  border-color: #779e63;
  box-shadow: 0 0 0 3px rgba(119, 158, 99, 0.1);
}

.btn-add-note {
  padding: 10px 20px;
  background: linear-gradient(135deg, #779e63 0%, #596d52 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-add-note:hover {
  transform: translateY(-2px);
  box-shadow: rgba(0, 0, 0, 0.2) 0px 4px 12px;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note-item {
  background: white;
  padding: 12px 15px;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.note-text {
  color: #2c4b2c;
  font-size: 14px;
  flex: 1;
}

.btn-delete-note {
  background: #d9534f;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-delete-note:hover {
  background: #c9302c;
  transform: scale(1.05);
}

/* ===== Shipping Cost Section ===== */
.shipping-cost-section {
  margin: 20px 0;
  padding: 20px;
  background: #e0ead1;
  border-radius: 8px;
}

.cost-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.cost-label {
  color: #2c4b2c;
  font-size: 16px;
  font-weight: 600;
}

.cost-value {
  color: #2c4b2c;
  font-size: 24px;
  font-weight: 700;
}

.add-cost-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.cost-input {
  width: 120px;
  padding: 10px 12px;
  border: 2px solid #d0dac1;
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
  transition: all 0.3s ease;
}

.cost-input:focus {
  outline: none;
  border-color: #779e63;
  box-shadow: 0 0 0 3px rgba(119, 158, 99, 0.1);
}

.btn-add-cost {
  width: 40px;
  height: 40px;
  background: #2c4b2c;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-add-cost:hover {
  background: #1e3a1e;
  transform: scale(1.1);
}

/* ===== Rating Section ===== */
.rating-section {
  margin: 20px 0;
  padding: 20px;
  background: #fdf9f4;
  border-radius: 8px;
}

.rating-title {
  color: #2c4b2c;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 15px;
}

.stars-container {
  display: flex;
  gap: 12px;
  margin-bottom: 15px;
  justify-content: flex-end;
  flex-direction: row-reverse;
}

.star-wrapper {
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
}

.star-wrapper i {
  font-size: 36px;
  color: #e0e0e0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.star-number {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  font-weight: 700;
  color: #666;
  pointer-events: none;
}

.star-wrapper:hover i,
.star-wrapper.hover i {
  color: #ffe082;
  transform: scale(1.15);
}

.star-wrapper:hover .star-number,
.star-wrapper.hover .star-number {
  color: #fff;
}

.star-wrapper.active i {
  color: #ffc107;
  transform: scale(1.2);
  text-shadow: 0 3px 8px rgba(255, 193, 7, 0.4);
}

.star-wrapper.active .star-number {
  color: #fff;
  font-weight: 800;
}

.rating-notes {
  margin-bottom: 15px;
}

.rating-textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 2px solid #e0ead1;
  border-radius: 8px;
  font-size: 14px;
  resize: vertical;
  transition: all 0.3s ease;
  font-family: inherit;
}

.rating-textarea:focus {
  outline: none;
  border-color: #779e63;
  box-shadow: 0 0 0 3px rgba(119, 158, 99, 0.1);
}

.btn-submit-rating {
  padding: 10px 25px;
  background: linear-gradient(135deg, #2c4b2c 0%, #1e3a1e 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-submit-rating:hover {
  transform: translateY(-2px);
  box-shadow: rgba(0, 0, 0, 0.2) 0px 4px 12px;
}

/* ===== Delivery Confirmation Button ===== */
.btn-confirm-delivery {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-confirm-delivery:hover {
  transform: translateY(-3px);
  box-shadow: rgba(0, 0, 0, 0.3) 0px 8px 20px;
}

.btn-confirm-delivery:active {
  transform: translateY(0);
}

/* ===== Delivery Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-container {
  direction: rtl;
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 450px;
  box-shadow: rgba(0, 0, 0, 0.4) 0px 20px 60px;
  animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(-50px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  background: linear-gradient(135deg, #e0ead1 0%, #f9efe3 100%);
  padding: 20px 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 16px 16px 0 0;
}

.modal-header h3 {
  color: #2c4b2c;
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: #2c4b2c;
  font-size: 20px;
  cursor: pointer;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.btn-close-modal:hover {
  background: rgba(44, 75, 44, 0.1);
  transform: rotate(90deg);
}

.modal-body {
  padding: 30px 25px;
  text-align: center;
}

.modal-question {
  color: #2c4b2c;
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 25px;
  direction: rtl;
}

.modal-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.btn-modal-confirm,
.btn-modal-cancel {
  padding: 12px 30px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 120px;
}

.btn-modal-confirm {
  background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
  color: white;
}

.btn-modal-confirm:hover {
  transform: translateY(-2px);
  box-shadow: rgba(0, 0, 0, 0.2) 0px 4px 12px;
}

.btn-modal-confirm.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn-modal-cancel {
  background: #f5f5f5;
  color: #666;
}

.btn-modal-cancel:hover {
  background: #e0e0e0;
}

.btn-loader {
  display: inline-block;
}

.rotating {
  animation: rotate 1s linear infinite;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ===== Toast Notification ===== */
.toast-notification {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #2c4b2c 0%, #1e3a1e 100%);
  color: white;
  padding: 15px 30px;
  border-radius: 50px;
  box-shadow: rgba(0, 0, 0, 0.3) 0px 8px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 500;
  z-index: 2000;
  transition: bottom 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast-notification.show {
  bottom: 30px;
}

.toast-icon {
  font-size: 20px;
  color: #a8d08d;
}

.empty-message {
  text-align: center;
  color: #596d52;
  padding: 40px;
  font-size: 16px;
  direction: rtl;
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
  .orders-section,
  .statistics-section,
  .page-header {
    width: 90%;
    margin-left: 5%;
  }

  .statistics-section {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .statistics-section {
    grid-template-columns: 1fr;
    width: 90%;
  }

  .orders-section {
    width: 90%;
  }

  .page-header {
    width: 90%;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
  }

  .order-details {
    grid-template-columns: 1fr;
  }

  .add-note-form,
  .add-cost-form {
    flex-direction: column;
    align-items: stretch;
  }

  .cost-input {
    width: 100%;
  }

  .modal-actions {
    flex-direction: column;
  }

  .btn-modal-confirm,
  .btn-modal-cancel {
    width: 100%;
  }

  .orders-list {
    flex-direction: column;
  }

  .rating-section {
    padding: 15px;
  }

  .stars-container {
    justify-content: center;
  }
}
